#!/bin/bash

showport() {
    local port=$1
    local connections=$(netstat -tuln | grep ":$port\s")

    if [ -n "$connections" ]; then
        echo "Port $port is in use:"
        echo "$connections" | while read line; do
            echo "$line"
        done
    else
        echo "Port $port is free"
    fi
}